﻿using System;
using System.Collections.Generic;
using System.Text;
using libCommonClass;
using libReadWrite;

namespace TTServer.Messages
{
    class PPTWindowsRelationshipResponse : TTMessage
    {
        private String _temporaryKey;

        public String TemporaryKey
        {
            get { return _temporaryKey; }
            set { _temporaryKey = value; }
        }

        private String[] _presentationNames;

        public String[] PresentationNames
        {
            get { return _presentationNames; }
            set { _presentationNames = value; }
        }

        private int _activeWindowIndex = -1;

        public int ActiveWindowIndex
        {
            get { return _activeWindowIndex; }
            set { _activeWindowIndex = value; }
        }

        public override void ReadMessage(BigEndianReader sr)
        {
            throw new NotImplementedException();
        }

        public override void WriteMessage(BigEndianWriter sw)
        {
            sw.Write((byte)MessageKind.PPT_WINDOWS_RELATIONSHIP_RESPONSE);
            sw.Write(Global.NO_LENGTH_CODE);

            sw.WriteString(this._temporaryKey);

            if (this._presentationNames != null)
            {
                sw.Write(this._presentationNames.Length);

                foreach (String str in this._presentationNames)
                {
                    sw.WriteString(str);
                }
            }
            else {
                sw.Write(0);
            }

            sw.Write(this._activeWindowIndex);
            
        }

        public override TTMessage Clone()
        {
            return new PPTWindowsRelationshipResponse();
        }

        public override int GetMessageID()
        {
            return MessageKind.PPT_WINDOWS_RELATIONSHIP_RESPONSE;
        }

        public override string GetMessageName()
        {
            return "PPTWindowsRelationshipResponse";
        }
    }
}
